package threadDemo;

/**
 * 静态代理模式
 */
public class Test8 {
    public static void main(String[] args) {
        You you = new You();
        WeddingCompany w = new WeddingCompany();
        w.WeddingCompany(you);
        w.HappyMarry();
    }

}
interface Marry {
    void HappyMarry();
}

class You implements Marry {

    @Override
    public void HappyMarry() {
        System.out.println("老李结婚了");
    }
}

class WeddingCompany implements Marry{

    private Marry target;

    public void WeddingCompany(Marry marry) {
        this.target = marry;
    }

    @Override
    public void HappyMarry() {
        before();
        this.target.HappyMarry();
        after();
    }

    private void after() {
        System.out.println("收尾款");
    }

    private void before() {
        System.out.println("准备酒席");
    }
}
